#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
using namespace std;

class Person
{

public:
    Person(string name,int age):_name(name),_age(age){}
    virtual void print()
    {
        cout << "Name: " << _name << ", Age: " << _age << endl;
    }

protected:
    string _name;
    int _age;
};

class Student:virtual public Person
{
public:
    int _stdid;
    string _address;

    Student(string name,int age,int stdid,string address)
            :Person(name,age),_stdid(stdid),_address(address)
    {
        cout << "Student constructor" << endl;
    }

    void print()
    {
        cout << "Student ID: " << _stdid << ", Address: " << _address << endl;
        Person::print();
    }

};

class Teacher:virtual public Person
{
public:
    int _teaid;
    string _department;

    Teacher(string name,int age,int teaid,string department)
            :Person(name,age),_teaid(teaid),_department(department)
    {
        cout << "Teacher constructor" << endl;
    }

    void print()
    {
        cout << "Teacher ID: " << _teaid << ", Department: " << _department << endl;
        Person::print();
    }
};

//会出现菱形继承的问题，解决方法：使用虚继承
class Assistant:public Student,public Teacher
{
public:
    int _assid;
    string _project;

    Assistant(string name,int age,int assid,string project)
        : Person(name, age),
          Student(name, age, 0, ""),
          Teacher(name, age, 0, ""),
          _assid(assid), _project(project)
    {
        cout << "Assistant constructor" << endl;
    }

    void print()
    {
        cout << "Assistant ID: " << _assid << ", Project: " << _project << endl;
        Student::print();
        Teacher::print();
    }
};
